﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace CRConsult.Models
{
    public class userRepository
    {
        /// <summary>
        /// 判断用户是否存在
        /// </summary>
        /// <param name="username"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public bool checkUser(string username, string password) {
            using (LingHealEntities db = new LingHealEntities()) {
                var _user = db.tb_User.FirstOrDefault(a => a.UserName.Equals(username) && a.Password.Equals(password));
                //var _user = from q in db.tb_User
                //            where q.UserName.Equals(username) && q.Password.Equals(password)
                //            select q;

                if (_user == null) return false;
            }
            return true;
        }
    }
}